/**
* Provides the Game State for GOC
*
* @file src/GameState.cpp
* @author Jacob Dix
* @date 20120519 - Initial Release
*/

#ifndef   GAME_STATE_HPP_INCLUDED
#define   GAME_STATE_HPP_INCLUDED
#include "TmxAsset.hpp"
#include <GQE/Core/Core_types.hpp>
#include <GQE/Core/interfaces/IState.hpp>
#include <SFML/Graphics.hpp>
#include <GQE/Entity/systems/AnimationSystem.hpp>
#include <GQE/Entity/systems/MovementSystem.hpp>
#include <GQE/Entity/systems/RenderSystem.hpp>
#include <GQE/Entity/systems/ActionSystem.hpp>
#include "CollisionSystem.hpp"
#include "ControlSystem.hpp"
class GameState : public GQE::IState
{
public:
/**
* GameState constructor
* @param[in] theApp is an address to the App class.
*/
GameState(GQE::IApp& theApp);

/**
* GameState deconstructor
*/
virtual ~GameState(void);

/**
* DoInit is responsible for initializing this State
*/
virtual void DoInit(void);

/**
* ReInit is responsible for Reseting this state when the
* StateManager::ResetActiveState() method is called.  This way a Game
* State can be restarted without unloading and reloading the game assets
*/
virtual void ReInit(void);

/**
* HandleEvents is responsible for handling input events for this
* State when it is the active State.
* @param[in] theEvent to process from the App class Loop method
*/
virtual void HandleEvents(sf::Event theEvent);

/**
* UpdateFixed is responsible for handling all State fixed update needs for
* this State when it is the active State.
*/
virtual void UpdateFixed(void);

/**
* UpdateVariable is responsible for handling all State variable update
* needs for this State when it is the active State.
* @param[in] theElapsedTime since the last Draw was called
*/
virtual void UpdateVariable(float theElapsedTime);

/**
* Draw is responsible for handling all Drawing needs for this State
* when it is the Active State.
*/
virtual void Draw(void);
void LoadMap(std::string theFilename);
GQE::IEntity*				 mPlayer;
protected:
static const GQE::PrototypeManager& GetPrototypeManager();

/**
* HandleCleanup is responsible for performing any cleanup required
* before this State is removed.
*/
virtual void HandleCleanup(void);

void ParseProperties(GQE::IEntity* theInstance,std::map<std::string,std::string,std::less<std::string> > thePropertyList);
private:
GQE::AnimationSystem mAnimationSystem;
GQE::MovementSystem  mMovementSystem;
GQE::RenderSystem    mRenderSystem;
ControlSystem        mControlSystem;
CollisionSystem      mCollisionSystem;
GQE::ActionSystem    mActionSystem;
GQE::Prototype       mFloorTile;
GQE::Prototype       mFloorTileMask;
GQE::Prototype			 mMidTile;
GQE::Prototype			 mMidTileMask;
GQE::Prototype			 mUpperTile;
GQE::Prototype			 mUpperTileMask;
GQE::Prototype       mCharacter;
GQE::Prototype       mWarp;
GQE::Prototype       mAttack;
GQE::Prototype			 mItem;
GQE::ImageAsset      mDirtTileset;
GQE::ImageAsset      mPlayerImage;
GQE::ImageAsset      mWallTileset;
GQE::ImageAsset      mWaterTileset;
GQE::ImageAsset      mGUITiles;
GQE::FontAsset       mFont;
GQE::MusicAsset			 mMusic;
sf::Sprite           mInterface;

static GQE::PrototypeManager gPrototypeManager;
}; // class GameState

#endif // GAME_STATE_HPP_INCLUDED

/**
* @class GameState
* @ingroup Examples
* The EntityTest GameState class provides the EntityTest example game
* implementation for the GQE library.
*
* Copyright (c) 2010-2011 Ryan Lindeman
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
